package com.project.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.DisasterPrevention.RegionBean;
import com.project.mapper.IRegionMapper;
import com.project.service.IRegionService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class IRegionServiceImpl extends ServiceImpl<IRegionMapper, RegionBean> implements IRegionService {

    @Resource
    private IRegionMapper regionMapper;


    @Override
    public IPage<RegionBean> findCutRegion(int pageNo, int pageSize, String regionName, String regionForest, String className) {

        Page<RegionBean> page = new Page<>(pageNo,pageSize);

        return this.regionMapper.findCutRegion(page,regionName,regionForest,className);

    }

    @Override
    public void addRegion(RegionBean regionBean) {

        this.baseMapper.insert(regionBean);

    }

    @Override
    public List<RegionBean> findAll() {

        return this.baseMapper.selectList(null);

    }
}
